package serveratm;


import org.apache.log4j.Logger;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public abstract class ServerATM {

    private static final Logger logger = Logger.getLogger(ServerPerformer.class);

    public enum Keywords {
        ;
        public static final String WAITING_CONNECTION = "\nServer Started, starting story logs \nWaiting for client connection ...";
        public static final String CONNECTED = "The client is connected.";
    }
    ;
    public static void main(String[] args) throws IOException {
        ServerSocket soc = new ServerSocket(7001);
        System.out.println(soc + Keywords.WAITING_CONNECTION);
        while (true) {
            Socket socket = soc.accept();
            logger.info("new connection " + socket.toString());
            System.out.println(Keywords.CONNECTED);
            new ServerPerformer(socket);
        }
    }
}
